package model.enums;


import com.alibaba.fastjson.JSONObject;

import java.util.Arrays;



public enum MessageTypeEnum {

    ORDER(1, "订单提醒","ORDER"),
    REFUND(2, "退款提醒","REFUND"),
    AFTERSALE(3, "售后提醒","AFTERSALE"),
    COUPON(4, "优惠券提醒","COUPON"),
    ACTIVITY(5, "活动通知","ACTIVITY"),
    COMMENT(6, "评论通知","COMMENT");


    private Integer code;
    private String remark;
    private String name;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    MessageTypeEnum(Integer code, String remark, String name) {
        this.code = code;
        this.remark = remark;
        this.name = name;
    }

    public static Boolean getMessageTyFlagByName(String Name) {
        return  Arrays.stream(MessageTypeEnum.values()).anyMatch(i->i.getName().equals(Name));
    }

    public static ItemEum getItemEumByName(String Name) {
        ItemEum itemEum  = new ItemEum();
        Arrays.stream(MessageTypeEnum.values()).forEach(i->{
             if(i.getName().equals(Name)){
                 itemEum.setRemark(i.getRemark());
                 itemEum.setName(Name);
                 itemEum.setCode(i.getCode());
             }
        });
        return itemEum;
    }


    public static void main(String[] args) {

        System.out.println(JSONObject.toJSON(ChildTypeEnum.getChildTypeEnumList()));
    }
}
